#ifndef __DERIVE_H__
#define __DERIVE_H__

/** 
 * \brief 1st order derivative calculation
 *
 * The calculation depends on sampling frequency
 *
 * \ingroup Model 
 *
 * \param[in] x input
 * \param z internal state
 * \param[in] SamplingFreq
 *
 * \return double derivative
 */
static __inline double derive(double x, double* z, const double SamplingFreq)
{
    double z0 = x * SamplingFreq;

    double acc = z0 - (*z);    

    *z = z0;

    return acc;
}

#endif // __DERIVE_H__
